package demo.websocket.server.example3;

import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.core.MessageSendingOperations;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalTime;

//@Component
public class ScheduledController {

//    @Autowired
//    private final MessageSendingOperations<String> messageSendingOperations;
//
//    public ScheduledController(MessageSendingOperations<String> messageSendingOperations) {
//        this.messageSendingOperations = messageSendingOperations;
//    }
//
//    @Scheduled(fixedDelay = 600000)
//    public void sendPeriodicMessages() {
//        String broadcast = String.format("server periodic message %s via the broker", DateUtil.now());
//        this.messageSendingOperations.convertAndSend("/topic/periodic", broadcast);
//    }
//
//    @Scheduled(fixedDelay = 600000)
//    public void sendPeriodicMessages2() {
//        String broadcast = String.format("server periodic message %s via the broker", DateUtil.now());
//        this.messageSendingOperations.convertAndSend("/topic/subscribe2", broadcast);
//    }
}
